//
//  CCTVViewController.m
//  Qihuo
//
//  Created by Cheng Qi on 13-12-14.
//  Copyright (c) 2013年 Vencoo. All rights reserved.
//

#import "CCTVViewController.h"

@interface CCTVViewController ()

@end

@implementation CCTVViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
#pragma mark--Resource
-(void)changeView
{
    self.sendUrl = addCCTV;
    UIImage *blackImage = [UIImage imageNamed:@"黑底"];
    self.myTableView.frame=CGRectMake(interval111/2, 64, 0,screenHeight - blackImage.size.height-64);
    self.whiteImageView.frame=CGRectMake(self.myTableView.frame.origin.x + self.myTableView.frame.size.width, self.myTableView.frame.origin.y, scrennWidth - (self.myTableView.frame.origin.x)*2 -self.myTableView.frame.size.width, self.myTableView.frame.size.height);
    self.backScrollV.frame =CGRectMake(10, 10, self.whiteImageView.frame.size.width - 20, self.whiteImageView.frame.size.height - 20);
    [self.backScrollV setContentSize:CGSizeMake(self.backScrollV.frame.size.width, 1750)];
    NSLog(@"width:%f--height:%f",self.backScrollV.frame.size.width,self.backScrollV.frame.size.height);
    _contentView =[[[NSBundle mainBundle]loadNibNamed:@"CCTV" owner:self options:nil]lastObject];
    [self.backScrollV addSubview:_contentView];
    
    UIButton *btn = (UIButton *)[self.blackView viewWithTag:0];
    [btn setImage:[UIImage imageNamed:@"提交"] forState:UIControlStateNormal];
}
#pragma mark - keyboardNotification
CGSize keyboardSize;
- (void) keyboardWasShown:(NSNotification *) notif
{
//    NSDictionary *info = [notif userInfo];
//    NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];
//    keyboardSize = [value CGRectValue].size;
//    NSLog(@"keyBoard:%f", keyboardSize.width);  //216
//    _backScrollV.contentSize = CGSizeMake(_backScrollV.frame.size.width, _commentTv.frame.origin.y + _commentTv.frame.size.height + interval111+406);
    if (self.blackGroundV.hidden == NO)
    {
        [UIView animateWithDuration:.5 animations:^{
            self.blackGroundV.frame = CGRectMake(0, -150, 1024, 768);
        }];
    }
    if (self.blackStopV.hidden == NO) {
        [UIView animateWithDuration:.5 animations:^{
            self.blackStopV.frame = CGRectMake(0, -150, 1024, 768);
        }];
    }
}
- (void) keyboardWasHidden:(NSNotification *) notif
{
//    NSDictionary *info = [notif userInfo];
//    NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];
//    CGSize keyboardSize = [value CGRectValue].size;
//    NSLog(@"keyboardWasHidden keyBoard:%f", keyboardSize.width);
//    _backScrollV.contentSize = CGSizeMake(_backScrollV.frame.size.width, _commentTv.frame.origin.y + _commentTv.frame.size.height + interval111);
    if (self.blackGroundV.hidden == NO)
    {
        [UIView animateWithDuration:0.5 animations:^{
            self.blackGroundV.frame = CGRectMake(0, 0, 1024, 768);
        }];
    }
    if (self.blackStopV.hidden == NO) {
        [UIView animateWithDuration:.5 animations:^{
            self.blackStopV.frame = CGRectMake(0, 0, 1024, 768);
        }];
    }
}
- (void)viewDidLoad
{
    self.title =@"视频监控系统每周巡查表";
    [super viewDidLoad];
    [self changeView];
    self.sendFloorDatas = [NSMutableArray arrayWithObjects:
        @{@"checkId": @"1",@"result":@"<#string#>"},
        @{@"checkId": @"2",@"result":@"<#string#>"},
        @{@"checkId": @"3",@"result":@"<#string#>"},
        @{@"checkId": @"4",@"result":@"<#string#>"},
        @{@"checkId": @"5",@"result":@"<#string#>"},
        @{@"checkId": @"6",@"result":@"<#string#>"},
        @{@"checkId": @"7",@"result":@"<#string#>"},
        @{@"checkId": @"8",@"result":@"<#string#>"},
        @{@"checkId": @"9",@"result":@"<#string#>"}, nil];
}
- (void)jajajajaj:(UIButton *)btn
{
    switch (btn.tag) {
        case 0:
        {
            [self.alertV textFieldAtIndex:0].text = [[Appinfomation shareIstance].loginDic valueForKey:@"user"];
            [self.alertV show];
        }
            break;
            
        default:
            break;
    }
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
    [self.sendFloorDatas replaceObjectAtIndex:textField.tag - 10 withObject:@{@"checkId": [NSString stringWithFormat:@"%i",textField.tag - 9],@"result":[textField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]}];
}
- (void)textViewDidEndEditing:(UITextView *)textView
{
    
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
